<?php

include 'libs/nusoap.php';

$client = new SoapClient('http://localhost/converst/?wsdl');


$filename = 'd:/KOR01.odt';

$fhandle = fopen($filename, "rb");

$file_content = fread($fhandle, filesize($filename));

$buff = base64_encode($file_content);

fclose($fhandle);


$result = $client->Convert($buff, 'pdf');

if ($result != null) {
    $pdf = 'd:/document.pdf';
    file_put_contents($pdf, base64_decode($result));
    header('Content-Type: application/pdf');
    header('Content-Length: ' . filesize($pdf));
    readfile($pdf);
    @unlink($pdf);
}
?>
